@echo off

set HIS=1
echo patch count[%HIS%]
set /p HIS=

if "%HIS%" == "" set HIS=1

cd %~dp0

echo clean previous patch files...
del /Q *.patch
del /Q *.patch.cp

echo generate patch file ...
echo "git format-patch -%HIS%"

git format-patch -%HIS%

echo generated patch file done

call groovy .\makepatch.groovy %~dp0

echo remove patch files?[y]
set /p YN=

if "%YN%" == "" goto remove
goto end

:remove
del /Q *.patch
del /Q *.patch.cp
echo patch file removed!

:end
